<div class="page-wrapper d-flex flex-column pt-4">
    <div class="container-xl">
        <div class="page-header d-print-none">
            <div class="row align-items-center">
                <div class="col">
                    <div class="page-pretitle">
                        Update
                    </div>
                    <h3 class="page-title">
                        Existing User
                    </h3>
                </div>
            </div>
        </div>
    </div>
    <div class="page-body d-flex flex-row-reverse">


        <aside class="bd-sidebar sub-sidebar" ng-if="activedUser">
            <nav class="bd-links p-3" aria-label="Sub-section navigation">
                <div class="card card-body">
                    <!-- <actions preview-url="activedUser.fullPath" back-url="'/portal/user/list'"></actions> -->

                    <div class="btn-group w-100 mb-4" role="group">
                        <button ng-if="!isInRole('Viewer')" id="btnToSubmit" type="button" ng-click="save()"
                            class="btn btn-primary text-white">
                            <i class="fa fa-save"></i>
                            <span ng-bind="translate('Save')"></span>
                        </button>
                    </div>
                </div>
            </nav>
        </aside>

        <!-- ----------------------------------------------------------- -->

        <div class="content-body py-3 pe-3">
            <!-- Main content -->
            <section class="" ng-init="loadUser()">

                <div class="card mb-4">
                    <div class="card-body">
                        <form ng-if="activedUser" ng-class="{'submitted': submitted}" ng-submit="saveUser(activedUser)">
                            <div class="mb-3">
                                <label class="form-label">Username</label>
                                <input type="text" class="form-control form-control-lg" readonly
                                    ng-model="activedUser.user.userName" />
                            </div>
                            <div class="mb-3">
                                <label class="form-label">Email</label>
                                <input type="text" class="form-control" ng-model="activedUser.user.email" />
                            </div>
                            <div class="row">
                                <div class="col mb-3">
                                    <label class="form-label">First Name</label>
                                    <input type="text" class="form-control" ng-model="activedUser.user.firstName" />
                                </div>
                                <div class="col mb-3">
                                    <label class="form-label">Last Name</label>
                                    <input type="text" class="form-control tags" ng-model="activedUser.user.lastName" />
                                </div>
                            </div>
                            <label class="form-label">Active roles</label>
                            <div class="tab-pane" ng-if="activedUser.userRoles.length>0">
                                <navs data="activedUser.userRoles" callback="updateRoleStatus(nav)"></navs>
                            </div>
                        </form>
                    </div>
                </div>
                <additional-value ng-if="activedUser" class="mb-4" additional-data="activedUser.userData"
                    database-name="'sys_user_data'" parent-type="'User'" parent-id="activedUser.id">
                </additional-value>
            </section>
            <!-- /.content -->
        </div>

    </div>
</div>